package com.novel.common.vo;

import com.novel.pojo.novel.NovelComment;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Id;
import java.util.Date;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CommentVo {
    @Id
    private String commentId;//评论id
    private String commentContent;//评论内容
    private String userId;//评论者id
    private String novelId;//小说id
    private String novelName;//小说名称
    private String chapterId;//章节id
    private String chapterName;//章节名称
    private Date createdTime;//创建时间
    private String userName;//用户昵称

    public static CommentVo convert(NovelComment novelComment){
        return CommentVo.builder()
                .chapterId(novelComment.getChapterId())
                .commentContent(novelComment.getCommentContent())
                .commentId(novelComment.getCommentId())
                .createdTime(novelComment.getCreatedTime())
                .novelId(novelComment.getNovelId())
                .userId(novelComment.getUserId())
                .userName(novelComment.getUserName())
                .build();
    }
}